package top.tanglizhi.springboot3.controller.user;

import lombok.RequiredArgsConstructor;

import org.springframework.web.bind.annotation.*;
import top.tanglizhi.springboot3.base.R;
import top.tanglizhi.springboot3.entity.user.AuthInfo;
import top.tanglizhi.springboot3.entity.user.TbAction;
import top.tanglizhi.springboot3.entity.user.TbUser;
import top.tanglizhi.springboot3.interceptor.AppInterceptor;
import top.tanglizhi.springboot3.service.AuthService;
import top.tanglizhi.springboot3.vo.AuthUser;

@RestController
@RequiredArgsConstructor
@RequestMapping("/auth")
public class AuthController {
    private final AuthService authService;

    @PostMapping("")
    public R<TbUser> login(@RequestBody AuthUser tbUser) {
        return authService.login(tbUser);
    }

    @GetMapping("")
    public R<TbUser> getUserInfo() {
        return authService.getLoginUser();
    }

    @DeleteMapping("")
    public R<String> logout() {
        return authService.logout();
    }

}
